﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using Apq.Windows.Controls;

namespace Apq.Windows.Forms
{
	/// <summary>
	/// Dock框架窗口(父窗体),使用前先创建主子窗体
	/// </summary>
	public partial class DockFrameForm : DockForm
	{
		private DockDocForm _DocForm;// 主子窗体
		/// <summary>
		/// 获取或设置主子窗体
		/// </summary>
		public DockDocForm DocForm
		{
			get { return _DocForm; }
			set
			{
				_DocForm = value;
				if (value != null)
				{
					_DocForm.DockFrame = this;
					if (DataBindings["Text"] != null)
					{
						DataBindings.Remove(DataBindings["Text"]);
					}
					DataBindings.Add("Text", _DocForm, "Text");
				}
			}
		}

		private TSProgressBarHelper _tspbHelper;
		/// <summary>
		/// 获取进度条助手
		/// </summary>
		public TSProgressBarHelper tspbHelper
		{
			get { return _tspbHelper; }
		}

		public override void SetUILang(UILang.UILang UILang)
		{
			if (DocForm != null)
			{
				DocForm.SetUILang(UILang);
			}
		}

		/// <summary>
		/// DockFrameForm
		/// </summary>
		public DockFrameForm()
		{
			InitializeComponent();

			_tspbHelper = new TSProgressBarHelper(tspb);
		}

		private void DockFrameForm_Shown(object sender, EventArgs e)
		{
			if (_DocForm != null)
			{
				_DocForm.Show(DockDoc);
			}
		}
	}
}
